#pragma once

#include <QtGui/QDoubleSpinBox>
#include <QtGui/QListWidget>
#include <QtGui/QStackedWidget>
#include <QtGui/QPushButton>
#include "particledefine.h"

namespace ParticleEditor
{
	class ForceWidget : public QWidget
	{
		Q_OBJECT
	public:
		ForceWidget(QWidget * parent = 0);
		~ForceWidget();
		void setForce(ParticleSystemLayer psl,int index);
		void copyLayer(ParticleSystemLayer psl,ParticleSystemLayer newpsl,int index);
	private:
		QDoubleSpinBox*												_forceXSpinBox;
		QDoubleSpinBox*												_forceYSpinBox;
		QDoubleSpinBox*												_forceZSpinBox;
		ParticleSystemLayer											_particleSystemLayer;
		int															_index;
	private slots:
		void slotsForceXSpinBoxValueChanged(double);
		void slotsForceYSpinBoxValueChanged(double);
		void slotsForceZSpinBoxValueChanged(double);
	};

	class AccelerationWidget : public QWidget
	{
		Q_OBJECT
	public:
		AccelerationWidget(QWidget * parent = 0);
		~AccelerationWidget();
		void setAcceleration(ParticleSystemLayer psl,int index);
		void copyLayer(ParticleSystemLayer psl,ParticleSystemLayer newpsl,int index);
	private:
		QDoubleSpinBox*												_accelerationXSpinBox;
		QDoubleSpinBox*												_accelerationYSpinBox;
		QDoubleSpinBox*												_accelerationZSpinBox;
		ParticleSystemLayer											_particleSystemLayer;
		int															_index;
	private slots:
		void slotsAccelerationXSpinBoxValueChanged(double);
		void slotsAccelerationYSpinBoxValueChanged(double);
		void slotsAccelerationZSpinBoxValueChanged(double);
	};

	class FluidFrictionWidget : public QWidget
	{
		Q_OBJECT
	public:
		FluidFrictionWidget(QWidget * parent = 0);
		~FluidFrictionWidget();
		void setFluidFriction(ParticleSystemLayer psl,int index);
		void copyLayer(ParticleSystemLayer psl,ParticleSystemLayer newpsl,int index);
	private:
		QPushButton*												_airButton;
		QPushButton*												_waterButton;
		QDoubleSpinBox*												_densitySpinBox;
		QDoubleSpinBox*												_viscositySpinBox;
		QDoubleSpinBox*												_overrideRadiusSpinBox;
		ParticleSystemLayer											_particleSystemLayer;
		int															_index;
	private slots:
		void slotsAirClick();
		void slotsWaterClick();
		void slotsDensitySpinBoxValueChanged(double);
		void slotsViscositySpinBoxValueChanged(double);
		void slotsOverrideRadiusSpinBoxValueChanged(double);
	};

	class ProgramWidget : public QWidget
	{
		Q_OBJECT
	public:
		ProgramWidget(QWidget * parent = 0);
		~ProgramWidget();

		void initProgram(ParticleSystemLayer psl);
		void copyLayer(ParticleSystemLayer psl,ParticleSystemLayer newpsl);
	private:
		QListWidget*										_operatorsList;
		QStackedWidget*										_operatorsStackedWidget;
		QPushButton*										_operatorsNewForceButton;
		QPushButton*										_operatorsNewAccelerationButton;
		QPushButton*										_operatorsNewFluidFrictionButton;
		QPushButton*										_operatorsDeleteOperatorsButton;
		ParticleSystemLayer									_particleSystemLayer;
		ForceWidget*										_forceWidget;
		AccelerationWidget*									_accelerationWidget;
		FluidFrictionWidget*								_fluidFrictionWidget;
		QWidget*											_defaultWidget;
		void refreshListWidget();
	private slots:
		void slotsNewForce();
		void slotsNewAcceleration();
		void slotsNewFluidFriction();
		void slotsDeleteOperators();
		void slotsSelectListViewChanged(int);
	};
}